package evq.codec.core.entities;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Vector implements Iterable<Double>, Cloneable {

	private List<Double> elements = new ArrayList<Double>();
	
	public Vector() {
	
	}
	
	public Vector(List<Double> elements) {
		super();
		this.elements = elements;
	}

	public void addElement(Double element) {
		this.elements.add(element);
	}
	
	public void removeElement(int position){
		
		this.elements.remove(position);
	}
	public Double getElement(int index) {
		return this.elements.get(index);
	}
	
	public void setElement(int position, double element){
		
		this.elements.remove(position);
		this.elements.add(position, element);
	}
	
	public Iterator<Double> iterator() {
		return this.elements.iterator();
	}
	
	public int size(){
		return this.elements.size();
	}
	
	public Object clone() throws CloneNotSupportedException {
		return new Vector(new ArrayList<Double>(this.elements));
	}
	
}
